#!/bin/bash
echo -e "\033[32m \033[1m"
echo '++++++++++++++++++++++主机信息+++++++++++++++++++++++++++++'
ip_info=`ifconfig |grep 'inet'| head -1 |awk '{print $2}'`
cpu_info1=`cat /proc/cpuinfo |grep 'model name' | tail -1 |awk -F: '{print $2}' | sed 's/^//g' |awk '{print $1,$3,$4,$NF}'`
cpu_info2=`cat /proc/cpuinfo |grep 'physical id' |sort |uniq -c |wc -l`
server_info=`hostname|tail -1`
disk_info=`fdisk -l |grep 'Disk' | grep -v 'identifier' |grep -v 'label type' | awk '{print $2,$3,$4}' | sed 's/,//g'`
mem_info=`free -m |grep 'Mem' | awk '{print "Total",$1,$2"M"}'`
load_info=`uptime |awk '{print "Current Load: " $(NF-2)}' | sed 's/\,//g'`

echo -e "Ip地址：$ip_info"
echo -e "主机名：$server_info"
echo -e "CPU型号：$cpu_info1"
echo -e "物理CPU数：$cpu_info2"
echo -e "磁盘信息：$disk_info"
echo -e "内存信息：$mem_info"
echo -e "负载情况：$load_info"
